<template>
	<view>
		
		<view  style="background: linear-gradient( 180deg, #FFEEEB 0%, #F8F8FA 100%);height: 310rpx;">
			<u-navbar title="最新消息" placeholder bg-color="transparent" :auto-back="true">
			
		
			</u-navbar>
		
		</view>
		<!-- <u-gap height="220rpx"></u-gap> -->
		
		<view class="u-p-20" style="margin-top: -140rpx;">
			<view v-for="(item,index) in list" class="u-bg-fff u-r-20 u-m-b-20" @click="tonav(item.id)">
				
				<view class="u-flex u-flex-between" style="padding: 30rpx 30rpx 0;">
					<view class="u-f-30 u-bold">{{item.name}}</view>
					<view class="u-f-24 u-c-999">{{$u.timeFormat(item.update_time, 'yyyy-mm-dd')}}</view>
				</view>
				<u-gap height="20rpx"></u-gap>
				<image :src="item.image" style="width: 710rpx;height: 300rpx;"></image>
				<view style="padding: 20rpx 30rpx;color: #646464;font-size: 25rpx;">
					{{item.desc}}
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				list: [],
				page: 1,
			}
		},
		onLoad(opt) {
			this.page = 1
			this.list = []
			this.getList()
		},
		onReachBottom() {
			this.getList()
		},
		methods: {
			tonav(e){
				uni.navigateTo({
					url:'/pages/message/detail?id='+e
				})
			},
			async getList() {
				if (this.page == -1) {
					return
				}

				let url = 'content/messageList'
				let res = await uni.$u.http.post(url, {
					page: this.page
					});
				let ls = getApp().mergePage(res, this.page, this.list);
				this.list = ls.list
				this.page = ls.total
			},
		}


	}
</script>

<style>
	page {
		background: #F8F8FA;
	}
</style>